#include "global_variables.h"


#define COSTOM_JSON_PATH "/data/costom.json"
namespace Global {

    namespace Water {
        int Count = 0;
        int ColdWaterCount = 0;
        int ColdWaterNum = 0;
        int waterTimeOut = 0;
        int bushuiCount = 0;
        int paishuiCount = 0;
        int bupaishuiCount = 0;
        int water_value = 0;
        int last_water_value = 0;
        int water_speed = 0;
        int speed_last_water_num = 0;
        uint64_t speed_last_time = 0;
        int SelWaterTemp = 0;
        int RelaTemp = 0;
        bool isStartHot = false;
        int BoilingPoint = 95;
        int TempButtonState[8] = {10, 25, 100, 45, 60, 70, 80, 90};
        bool is_increace = false;
        bool switch_zero_water = false;

        int8_t ledType = 1;	//出水开灯类型
        int ledTime = 60;	//出水开灯时间
        int coldTemp = 4;	//制冷停机温度
    }

    namespace Timer {
    	int CountH = 0;	 // 1h计时
        int CountS = 0;     // 10min计时
        int Counth = 0;     // 8h计时
        int htotalCount = 0;// 8h总计时间
        int totalCount = 0; // 10min总计时间
        int compressorTime;		//压缩机启动需间隔5分钟
        int freezingOnS;			//达成自动制冷条件秒数
        int freezingOffS;			//达成t停止制冷条件秒数
        int singleice = 600;					//单次制冰时间

        int iceHL;		//自定义制冰开始h
        int iceHR;		//自定义制冰结束h
        int iceML;
        int iceMR;

        int coldHL;		//自定义制冷开始h
        int coldHR;		//自定义制冷结束h
        int coldML;
        int coldMR;
    }


    namespace Flags {
        int WarnIndex = -1;		//当前警告类型-1表示没有
        bool is_warn_cartridge_over = false;	//是否已经报警滤芯寿命结束
        bool is_open_warn_cartridge_over = true;	//是否打开报警滤芯寿命结束
        bool is_warn_cartridge_dying = false;	//是否已经报警滤芯寿命即将结束

        bool IsCodeFalg = true;   // 打印信息是否开启标志位
        bool useDefaultTemp = false; // 是否使用默认温度

        int  LackOfWater = 0;         //缺水状态
        bool NavibarFalg = false;//判断故障界面是否已经退出
        bool bAutocheck = false;	//通讯故障
        bool is_updating = false;	//是否正在升级
        bool Serial_flag = false;      //串口已通标志
        bool is_init_ui = false;			//UI没起来不能报错

        bool Auto_refriger = false;		//制冷开启标志位
        bool Auto_iceing = false;		//自动制冰循环
        bool ice_sheded = false;			//脱冰完成
        bool ice_full = false;			//冰满
        bool TouchSound;		//触摸声音开关

        bool start_ice;					//一轮开启一次制冰泵
//        bool start_Micro;			//开启微动开关
        bool custom_ice;				//自定义时间开启制冰
        bool custom_cold;			//自定义时间开启制冷
        bool shortcutOut;			//快捷出冰开关
        bool shortcutLong;			//长按快捷出冰

        bool forceDefrost;			//强制出冰中
        bool internalCleaning;			//内部清洗中
    }

    namespace Log {
        std::string inquiry_a5_log = "";
        std::string inquiry_e5_b2_log = "";
        std::string inquiry_e5_fa_log = "";
        std::string inquiry_e5_e1_log = "";
        std::string inquiry_a2_log = "";  	//a2指令打印
    }

    namespace Other{
        const int INVALID_VALUE = INT32_MAX;
        int last_cool_water_realtime_temp = INVALID_VALUE; //上次实时冷水温度
        int water_index = 0; // 当前水模式索引？ 需要更多上下文
        int water_reset_index = 0;
        int beepVod = 0;      //限制蜂鸣：为0时500ms响三声，为1时不响
    	int CountZuart = 0;
    	int jinggaocashi = 0; //for text（警告测试）
    }

    JsonHandler j_handler(COSTOM_JSON_PATH);
}
